/*
 * @Author: lixiaowei
 * @Date: 2021-04-09 11:52:18
 * @LastEditors: lixiaowei
 * @LastEditTime: 2021-04-09 12:43:28
 * @Description: 
 * @FilePath: /heima-bli/泛型编程/demo1.cpp
 */
#include <iostream>
#include <string>
using namespace std;

// 泛型
template <class T>
T maxV(T a, T b)
{
  return a > b ? a : b;
}
// 特化
template <>
char *maxV(char *a, char *b)
{
  return (strcmp(a, b) > 0 ? a : b);
}
template<class T1, class T2>
int maxV(T1 a, T2 b) {
  return static_cast<int>(a > b ? a : b);
}

int main()
{
  cout << maxV(1, 2) << endl;
  cout << maxV(1.5, 2.5) << endl;
  cout << maxV('a', 'b') << endl;
  cout << maxV("hello", "world") << endl;
  cout << maxV(10, 12.5) << endl;
  return 0;
}